package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : KongW
 * @create 2023/10/12 16:35
 */
@Mapper
public interface UserMapper {

    /**
     * 根据openid查询用户
     * @param openid
     * @return
     */
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    /**
     * 插入数据
     * @param user
     */
    void insert(User user);
    @Select("select * from user")
    User getById(Long userId);

    Integer countByMap(Map map);

    Integer countMap(Map map);






    @Select("select count(id) from user where create_time>#{begin} and create_time < #{end}")
    Integer countByTime(LocalDateTime begin, LocalDateTime end);
}
